package Utility.Utility;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * @author ABHIJIT DEY
 *
 */
public class JsoupParserApp 
{
    public static void main( String[] args ) throws Exception
    {
        System.out.println( " THIS APPLICATION DEMONSTRATE JSOUP HTML PARSING " );
        try
        {
        	Document document = Jsoup.connect("http://www.google.com/").get();
        	System.out.println(" CONNECTION ESTABLISHED ");
        	String pageTitle = document.title();
        	System.out.println(" PAGE TITLE : "+pageTitle);
        	Elements links = document.select("a[href]");
        	for(Element link:links )
        	{
        		System.out.println(" GRABBED LINKS ARE : "+link.attr("href") +" VALUE : "+link.text());
        	}
        }
        catch (Exception e) {
        	e.printStackTrace();
		}
       
    }
}
